package com.sk.ccflower.lib.commonUtils;

import java.io.File;
import java.util.Comparator;

public class SortFileUtil implements Comparator<Object>
{
	protected boolean 	m_isAscending = true;
	
	//
	//
	public SortFileUtil(boolean _isAscending) throws Exception
	{
		m_isAscending = _isAscending;
	}
	
	public int compare(Object _obj1, Object _obj2) throws ClassCastException
	{
		int res = -1;
		
		try
		{
			res = ((File)_obj1).compareTo((File)_obj2);
		}
		catch (ClassCastException e)
		{
			throw e;
		}
		catch (Exception e)
		{
			throw new ClassCastException(e.toString());
		}
		
        return m_isAscending ? res : res*(-1); 
    }
}

